﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Nirvana
{
    /// <summary>
    /// Variable属性，控制UIVariable各变量值
    /// </summary>
    public class VariableNameAttribute : PropertyAttribute
    {
        private int _value;
        public VariableNameAttribute()
        {
            this._value = 31;
        }
        public VariableNameAttribute(UIVariableType t)
        {
            this._value = 1 << (int)t;
        }

        public VariableNameAttribute(UIVariableType t1, UIVariableType t2)
        {
            this._value = (1 << (int)t1 | 1 << (int)t2);
        }
        public VariableNameAttribute(UIVariableType t1, UIVariableType t2, UIVariableType t3)
        {
            this._value = (1 << (int)t1 | 1 << (int)t2 | 1 << (int)t3);
        }

        public VariableNameAttribute(UIVariableType t1, UIVariableType t2, UIVariableType t3, UIVariableType t4)
        {
            this._value = (1 << (int)t1 | 1 << (int)t2 | 1 << (int)t3 | 1 << (int)t4);
        }
        public bool IsValid(UIVariableType type)
        {
            return (this._value & 1 << (int)type) != 0;
        }
    }
}

